/*37218898_306040569 Lihi_Dery_Luba_Golosman*/

public class Main {

	final static int MAX_R = 101; //the maximum r we are looking at in this exercise (0-100)
	final static  String TRAIN_FILENAME = "dataset\\train.txt";
	final static  String TOPICS_FILENAME = "dataset\\topics.txt";
	final static int vocabularySize = 300000; 
	final static int NUM_CLUSTERS = 9; 

	
		
	
		 
	public static void main(String[] args) throws Exception {					
	    InputParser parser;
	    parser = new InputParser();
	    parser.setFilesName(TRAIN_FILENAME,TOPICS_FILENAME);
	    parser.parse();
	    
	    EMAlgorithm  em = new EMAlgorithm (parser.getDocuments(),parser.getCorpus(),parser.getTopics());
	    em.calculateExpectation();	   
	    int[][] m =em.getHistogram();
	    for (int j=0;j<parser.getTopics().size(); j++)
	    	System.out.print("\t"+j+":"+parser.getTopics().get(j));
	    System.out.println();
	    for (int i=0 ; i<m.length;i++)
	    {
	    	System.out.print(i);
	    	for (int j=0;j<m[i].length; j++)
	    		System.out.print("\t"+m[i][j]);
	    	System.out.println();		
	    }	
	    System.out.println("Accuracy: " +em.getAccuracy() );
	    System.out.println("we're done. have a good day");
	}

}
